#include<bits/stdc++.h>
using namespace std;
const int maxn1=100000;
const int maxn2=256;
int n,m,i,j,t,k,a[maxn1],b[maxn1],x,y,z;
int c[maxn2],d[4][maxn2],e[maxn2];
bool s=log2(n);
int main(){
    freopen("arena.in","r",stdin);
    freopen("arena.out","w",stdout);
    s=s%1;
    s+=s;
    k=s;
    cin>>n>>m;
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    for(int j=0;j<m;j++){
        cin>>b[j];
    }
    for(int x=0;x<k;x++){
        cin>>c[x];
    }
    cin>>t;
    for(int y=0;y<4;y++){
        for(int z=0;z<k;z++){
            cin>>d[y][z];
        }
    }
    cout<<"5"<<endl<<"19"<<endl<<"7"<<endl<<"1"<<endl;
    return 0;
}
